using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using QuanLyKhachSan.DTO;

namespace QuanLyKhachSan
{
    public class QuyDinhDAO
    {
        // Cap nhat quy dinh
        public static bool Update(QuyDinhDTO quyDinhdto)
        {
            int kq = 0;
            DataAccessHelper con = new SqlDataAccessHelper();
            string sql = "UPDATE QuyDinh SET phuThu=" + quyDinhdto.PhuThu + ",soKhachToiDa=" + quyDinhdto.SoKhachToiDa;
            kq = con.ExecuteNonQuery1(sql);
            if (kq > 0)
            {
                return true;
            }
            return false;
        }
        public static bool UpdatePhuThu(float phuThu)
        {
            int kq = 0;
            DataAccessHelper con = new SqlDataAccessHelper();
            string sql = "UPDATE QuyDinh SET phuThu=" + phuThu;
            kq = con.ExecuteNonQuery1(sql);
            if (kq > 0)
            {
                return true;
            }
            return false;
        }
        public static bool UpdateSoKhachToiDa(int soKhachToiDa)
        {
            int kq = 0;
            DataAccessHelper con = new SqlDataAccessHelper();
            string sql = "UPDATE QuyDinh SET soKhachToiDa=" + soKhachToiDa;
            kq = con.ExecuteNonQuery1(sql);
            if (kq > 0)
            {
                return true;
            }
            return false;
        }
        public static DataTable SoKhachToiDa()
        {
            DataTable dt = new DataTable();
            DataAccessHelper con = new SqlDataAccessHelper();
            string sql = "SELECT soKhachToiDa FROM QuyDinh";
            dt = con.ExecuteQuery(sql);
            return dt;
        }
        public static DataTable PhuThu()
        {
            DataTable dt = new DataTable();
            DataAccessHelper con = new SqlDataAccessHelper();
            string sql = "SELECT phuThu FROM QuyDinh";
            dt = con.ExecuteQuery(sql);
            return dt;
        }
        public static DataTable LayQuyDinh()
        {
            DataTable dt = new DataTable();
            DataAccessHelper con = new SqlDataAccessHelper();
            string sql = "SELECT * FROM QuyDinh";
            dt = con.ExecuteQuery(sql);
            return dt;
        }
    }
}
